<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
			console.log('App Launch')
			let link = window.location.href;
			if(link.indexOf('type=') != -1){
				let temp = link.split("type=")[1];
				let type = temp.split("&")[0];
				console.log(type,'type');
				if(type.includes('1#/') || type == 1){
					var openid = uni.getStorageSync('OPENID');
					if (!openid) {
						uni.reLaunch({
							url: 'pages/home/home?type=1'
						})
					}
				}else{
					var openid = uni.getStorageSync('OPENID');
					if (openid) {
						var token = uni.getStorageSync('token');
						console.log(token)
						if (!token) {
							uni.reLaunch({
								url: 'pages/admin/login'
							})
						}else{
							uni.reLaunch({
								url: '/pages/admin/index'
							})
						}
					} else {
						uni.reLaunch({
							url: 'pages/home/home?type=2'
						})
					}
					
				}
			}
			
		},
		onShow: function() {
			// console.log('App Show')
			
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	 @import "./uni_modules/uview-ui/index.scss";
	 .content{
		 background-color: #f6f6f6;
		 min-height: 100vh;
	 }
	 .red{
	 	color: #ff6969;
	 }
	      
	 .green{
	 	color: #23c3aa;
	 }
	 
	 .blue{
	 	color: #06a4fe;
	 }
	 
	 .orange{
	 	color: #ffc057;
	 }
</style>
